cmake_minimum_required(VERSION 3.5.0)
project(week4 VERSION 0.1.0 LANGUAGES C CXX)

set(CMAKE_EXPORT_COMPILE_COMMANDS True)

set(CMAKE_CXX_STANDARD 17)

add_subdirectory(libs/wxWidgets)
add_subdirectory(libs/json)

include_directories(${CMAKE_SOURCE_DIR}/includes)
include_directories(libs/json/single_include)

file(GLOB_RECURSE SOURCES "src/*.cpp")


# 动态链接目标
add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME} wx::net wx::core wx::base nlohmann_json::nlohmann_json)
set_target_properties(${PROJECT_NAME} PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
    OUTPUT_NAME "${PROJECT_NAME}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}"
)

# 自定义目标来复制 scripts 文件夹
add_custom_target(copy_scripts ALL
    COMMAND ${CMAKE_COMMAND} -E copy_directory
    ${CMAKE_SOURCE_DIR}/scripts $<TARGET_FILE_DIR:${PROJECT_NAME}>/scripts
    DEPENDS ${CMAKE_SOURCE_DIR}/scripts
)
